<template>
  <div id="app">
    <header class="head">
      <a class="back tl" href="javascript:history.back(-1)">
        <i class="el-icon-arrow-left"></i>
      </a>
      <a href="javascript:;" class="tc">
        <small class="font_18 co_f">法律法规</small>
      </a>
    </header>
    <main>
      <div class="lawdetail">
        <div class="article-title">
          <h2>{{listData.title}}</h2>
        </div>
        <span>
           <i class="el-icon-time"></i><span class="rn-domainTime">{{listData.createDate}}</span> 
        </span>
        <article>
           {{listData.content}}
        </article>
      </div>
    </main>
  </div>
</template>

<script>
  import {
    Newsdetail
  } from '../../api/api';
  export default {
    data() {
      return {
        listData: {},
        unid: this.$route.query.unid,
      };
    },
    methods: {
      //数据加载方法
      getData() {
        //定义需要传给通讯的参数： unid    
        let options = {
          params: {
            unid: this.unid,
          }
        }
  
        //调取接口
        Newsdetail(options).then((res) => {
          if (res.success === true) {
            this.listData = res.data;
          }
        })
      },
    },
    //页面加载时候
    mounted() {
      this.getData();
      //监听滚动
    }
  
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>
.lawdetail{
  padding:0px 10px;
  .article-title{
    h2{
      color: #333
    }
  }
  span{
        color: #999;
    i{ 
      vertical-align:text-bottom;
      margin-right:5px;
    }
  }
  article{
    margin-top: 10px;
    text-indent: 2rem;
    line-height: 1.5rem;
    font-size: 1rem;
  }
}
</style>
